#ifndef __TASK_H_
#define __TASK_H_
#include "context.h"
#include "list.h"

#define    TASK_STATUS_SUSPEND  0x01
#define    TASK_STATUS_READY    0x02

#define    TASK_STATUS_RUNNING  0x04

#define    TASK_STATUS_DELAY    0x08
#define    TASK_STATUS_EXIT     0x10
#pragma pack(1)
typedef struct taskTCB{
    uint32_t* stackPoint;
    int8_t   name[64];
    uint32_t priority;
    uint32_t waitTime;
    uint64_t sliceTime; 
    uint8_t state; /* task ready, task  */
    uint32_t taskId;
    list_node  schedlist;
    list_node  tlist;
}taskTCB;
#pragma pack()
typedef struct osTask{
    struct taskTCB* taskRun;
    struct taskTCB* taskNew;
}osTask;



typedef struct taskParam{
    uint32_t taskId;
    uint32_t priority;
    uint32_t stackSize;
    void (*entry)(void*);
}taskParam;

extern struct osTask  g_osTask;
extern struct taskTCB* g_idleTaskTCB;
extern uint32_t g_idleTaskID ;
void createTask(taskParam* taskParam, char* name);
void startOs(void);
void taskInit(void);
void createIdleTask(void);
struct taskTCB* getOsNewTask(void);
#endif  /*__TASK_H_*/

